/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.goods.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.goods.dao.ZtGoodsquanDao;
import com.jeesite.modules.goods.entity.ZtGoodsquan;
import com.jeesite.modules.test.dao.TestDataChildDao;

/**
 * 测试数据Service
 * 
 * @author ThinkGem
 * @version 2018-04-22
 */
@Service
@Transactional(readOnly = true)
public class ZtGoodsquanService extends CrudService<ZtGoodsquanDao, ZtGoodsquan> {
	
	@Autowired
	private TestDataChildDao testDataChildDao;
	/**
	 * 获取单条数据
	 * 
	 * @param testData
	 * @return
	 */
	@Override
	public ZtGoodsquan get(ZtGoodsquan ztGoodsquan) {
		ZtGoodsquan entity = super.get(ztGoodsquan);
		if (entity == null) {
			entity = new ZtGoodsquan();
		}
		return entity;
	}
	
	public List<ZtGoodsquan> findMh(ZtGoodsquan ztGoodsquan){
		return dao.findMh(ztGoodsquan);
	}
	
	public int findNumCount(ZtGoodsquan ztGoodsquan){
		return dao.findNumCount(ztGoodsquan);
	}

	/**
	 * 查询分页数据
	 * 
	 * @param page
	 *            分页对象
	 * @param testData
	 * @return
	 */
	@Override
	public Page<ZtGoodsquan> findPage(Page<ZtGoodsquan> page, ZtGoodsquan ztGoodsquan) {
		return super.findPage(page, ztGoodsquan);
	}
	
	@Transactional(readOnly = false)
	public void saveByOrder(ZtGoodsquan ztGoodsquan,Integer shuliang) {
		super.save(ztGoodsquan);
	/*	if(StringUtils.isNotBlank(guige)){
			TestDataChild testDataChild=new TestDataChild();
			testDataChild.setZtGoodsquan(ztGoodsquan);
			testDataChild.setId(guige);
			testDataChild=testDataChildDao.get(testDataChild);
			testDataChild.setTestSort(testDataChild.getTestSort()-shuliang);
			testDataChildDao.update(testDataChild);
		}*/
		
	}
	/**
	 * 保存数据（插入或更新）
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void save(ZtGoodsquan ztGoodsquan) {
		
		
		super.save(ztGoodsquan);
		
		
	}
	@Transactional(readOnly = false)
	public void updateZtGoodsid(ZtGoodsquan ztGoodsquan) {
		dao.updateZtGoodsid(ztGoodsquan);
		
	}
	
	
	/**
	 * 更新状态
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void updateStatus(ZtGoodsquan ztGoodsquan) {
		super.updateStatus(ztGoodsquan);
	}


	/**
	 * 删除数据
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void delete(ZtGoodsquan ztGoodsquan) {
		super.delete(ztGoodsquan);
	}

}